// 星星
import { _polygon } from './polygon.js'
import { starPoints } from '../algorithm/star.js'
import { polarPoints } from '../algorithm/polar.js'
import { _path } from './path.js'
import { PATH_MODE } from "../common/pathMode.js";
export const _star = (ctx, options = {}, props = {}) => {
    let { o, r, n, a, interiorPolygon = true } = options

    if (n > 4) {
        let points = polarPoints({ o, r, n, a })
        let ps = starPoints(points)

        if (interiorPolygon) {
            // ploygon 
            _path(ctx, {
                pathMode: PATH_MODE.LINE_LOOP,
                // ...options,
                points,
                // labels: null
            }, {
                ...props,
                strokeDasharray: 4
            })
        }


        // let star = 
        _path(ctx, {
            ...options,
            points: ps
        }, props)


    } else {
        // let star = 
        _polygon(ctx, {
            ...options,
            transform: 'paritySort',
        }, props)
    }

}
